<div class="bg-light lter b-b wrapper-md ng-scope">
    <h4 class="m-n font-thin">代理区域管理</h4>
</div>

<div class="wrapper-md ng-scope" ng-controller="agentAreaCtrl">

    <script type="text/ng-template" id="agentAreaAdd.html">
        <div ng-include="'tpl/agent/agent_area_add.html'"></div>
    </script>

    <div class="panel panel-default">
        <div class="row wrapper">
            <div class="col-sm-9">
                <form class="form-inline ng-pristine ng-valid">
                    <div class="form-group">
                        <div class="btn-group">
                            <label class="btn btn-default ng-pristine ng-untouched ng-valid" ng-model="agentArea.level" btn-radio="'0'" uncheckable="">省级</label>
                            <label class="btn btn-default ng-pristine ng-untouched ng-valid" ng-model="agentArea.level" btn-radio="'1'" uncheckable="">市级</label>
                            <label class="btn btn-default ng-pristine ng-untouched ng-valid" ng-model="agentArea.level" btn-radio="'2'" uncheckable="">区/县级</label>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label">代理名称</label>
                        <input type="text" class="input-sm form-control" ng-model="agentArea.name">
                    </div>
                    <button class="btn btn-sm btn-default" ng-click="query()">查询</button>
                </form>
            </div>
            <div class="col-sm-3">
                <div class="pull-right">
                    <a class="btn btn-sm btn-info" ng-click="openAdd()">新增区/县代理区</a>
                </div>
            </div>
            <div class="clearfix"></div>
        </div>


        <div class="table-responsive">
            <table class="table table-striped b-t b-light">
                <thead>
                <tr>
                    <th>级别</th>
                    <th>名称</th>
                    <th>地理位置</th>
                    <th width="130" class="text-center">操作</th>
                </tr>
                </thead>
                <tbody>
                <tr ng-repeat="a in list">
                    <td>
                        <span class="badge bg-danger" ng-if="a.level == 0">省</span>
                        <span class="badge bg-info" ng-if="a.level == 1">市</span>
                        <span class="badge bg-success" ng-if="a.level == 2">区/县</span>
                    </td>
                    <td>{{a.name}}</td>
                    <td>{{a.mapAreas}}</td>
                    <td class="t-btns text-right">
                        <button class="btn btn-sm btn-danger" ng-click="openDelete(a.id, a.name)" ng-if="a.level == 2">删除</button>
                        <button class="btn btn-sm btn-info" ng-click="openEdit(a.id, a.name, a.level)">修改</button>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
        <footer class="panel-footer">
            <div class="row">
                <div class="col-sm-4 hidden-xs">
                </div>
                <div class="col-sm-4 text-center">
                    <small class="text-muted inline m-t-sm m-b-sm">显示第 {{startRow}} 至 {{endRow}} 项结果，共 {{totalItems}} 项</small>
                </div>
                <div class="col-sm-4 text-right text-center-xs">
                    <pagination boundary-links="true" total-items="totalItems" ng-model="currentPage"
                                ng-change="pageChanged()" max-size="{{maxPageRow}}" class="pagination-sm m-t-none m-b"
                                previous-text="上一页" next-text="下一页"
                                first-text="首页" last-text="尾页"></pagination>
                </div>
            </div>
        </footer>
    </div>
</div>